#生成目标TARGET前请生成objs
# make objs
# make nbserv
# 存在问题：如果外部的objs已经在外部生成，再执行make objs会跳过这些objs
TAR_PING = Ping
TAR_TRACE = Traceroute
TAR_OBJS = objs

SRCS = $(wildcard ./*.c)
SRCS += ../NetWorkProDefine.c ../ErrMsgPro.c

OBJS = $(SRCS:.c=.o)
OBJS_PING = Ping.o NetWorkProDefine.o ErrMsgPro.o RawSocket.o 
OBJS_TRACE = NetWorkProDefine.o ErrMsgPro.o RawSocket.o Traceroute.o

INCLUDE += -I../
CFLAGS += -g

LDFLAGS += -lpthread

.PHONY: clean


$(TAR_OBJS):$(OBJS)

$(TAR_PING): $(OBJS_PING)
	$(CC) $^ $(LDFLAGS) -o $@

$(TAR_TRACE): $(OBJS_TRACE)
	$(CC) $^ -o $@

%.o: %.c 
	$(CC) $^ $(INCLUDE) $(CFLAGS) -c 

default: $(TAR_PING)

clean:
	-rm -f ./*.o 
	-rm -f $(TAR_OBJS)
	-rm -f $(TAR_PING)
	-rm -f $(TAR_TRACE)